package com.dragon.common.modules.file.common.config;

import com.dragon.common.modules.file.service.assistants.SeaweedFSClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Chris Chan
 * Create On 2025/8/26 下午5:01
 * Use for: Sample模块配置
 * Explain:
 */
@Configuration
@EnableConfigurationProperties({FileProperties.class})
public class FileModuleConfig {

    @Bean
    @ConditionalOnFileStrategy("seaweedfs")
    public SeaweedFSClient seaweedFSClient(FileProperties fileProperties) {
        return new SeaweedFSClient(
                fileProperties.getSeaweedfs().getFilter(),
                fileProperties.getSeaweedfs().getMaster(),
                fileProperties.getSeaweedfs().getRemote()
        );
    }
}
